package com.seckill.service.impl;

import com.seckill.dao.GoodsDao;
import com.seckill.service.GoodsService;
import com.seckill.vo.GoodsVo;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author yangjunwei
 * @date 2021/11/1 4:18 下午
 */
@Service
public class GoodsServiceImpl implements GoodsService {

    @Autowired
    GoodsDao goodsDao;

    @Override
    public List<GoodsVo> getGoodsList() {
        return goodsDao.listGoods();
    }

    @Override
    public GoodsVo selectGoodsVoById(long goodsId) {
        return goodsDao.selectGoodsById(goodsId);
    }

    @Override
    public boolean decrStock(long goodsId) {
        int decrStock = goodsDao.decrStock(goodsId);
        return decrStock > 0;
    }

    @Override
    public boolean incrStock(long goodsId) {
        int incrStock = goodsDao.incrStock(goodsId);
        return incrStock > 0;
    }


}
